﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="login" Then
	call login
else
	call index
end if
end Function



Function index
	dim rs2,sql2,Runtxt,rs3,sql3,i
	Runtxt=qingtian.RunStr
%>
	<card title="添加商品"><p align="left">

	名称：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>" value="" type="text"/><br/>
	图片地址：<br/>
	<input emptyok="true"  name="turul<%=Runtxt%>" value="" type="text"/><br/>
	商品编号：<br/>
	<input emptyok="true"  name="id1<%=Runtxt%>" value="" type="text"/><br/>
	商品货号：<br/>
	<input emptyok="true"  name="id2<%=Runtxt%>" value="" type="text"/><br/>
	分类：<br/>
	<%
	  set rs2=server.CreateObject("adodb.recordset")
	  sql2="select * from qingtian_shfeid"
	  rs2.open sql2,conn,1,1
	  if not (rs2.bof and rs2.eof) then
	  For i=1 to rs2.RecordCount
		if i=1 then
		%>
		<select name="feid<%=Runtxt%>" value="<%=rs2("id")%>">
		<%
		end if
		%>
		<option value="<%=rs2("id")%>"><%=qingtian.utf8(rs2("name"))%></option>
		<%
	  Rs2.MoveNext
	  Next
	else	
	%>
	<select name="feid<%=Runtxt%>" value="">
	<%
	  end if
	  Rs2.close
	  set rs2=nothing
	%>
	</select><br/>
	品牌：<br/>
	<%
	  set rs3=server.CreateObject("adodb.recordset")
	  sql3="select * from qingtian_shpaid"
	  rs3.open sql3,conn,1,1
	  if not (rs3.bof and rs3.eof) then
	  For i=1 to rs3.RecordCount
		if i=1 then
		%>
		<select name="paid<%=Runtxt%>" value="<%=rs3("id")%>">
		<%
		end if
		%>
		<option value="<%=rs3("id")%>"><%=qingtian.utf8(rs3("name"))%></option>
		<%
	  Rs3.MoveNext
	  Next
	else	
	%>
	<select name="paid<%=Runtxt%>" value="">
	<%
	  end if
	  Rs3.close
	  set rs3=nothing
	%>
	</select><br/>
	市场价：<br/>
	<input emptyok="true"  name="money<%=Runtxt%>" value="" type="text"/><br/>
	销售价：<br/>
	<input emptyok="true"  name="smoney<%=Runtxt%>" value="" type="text"/><br/>
	已售出：<br/>
	<input emptyok="true"  name="soid<%=Runtxt%>" value="0" type="text"/><br/>
	商品说明：<br/>
	<input emptyok="true"  name="ton<%=Runtxt%>" value="" type="text"/><br/>
	<anchor>确定提交
    	<go href="addshop.asp?Action=login&amp;sid=<%=sid%>" method='post'>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="turul" value="$(turul<%=Runtxt%>)"/>
        <postfield name="id1" value="$(id1<%=Runtxt%>)"/>
        <postfield name="id2" value="$(id2<%=Runtxt%>)"/>
        <postfield name="feid" value="$(feid<%=Runtxt%>)"/>
        <postfield name="paid" value="$(paid<%=Runtxt%>)"/>
        <postfield name="money" value="$(money<%=Runtxt%>)"/>
        <postfield name="smoney" value="$(smoney<%=Runtxt%>)"/>
        <postfield name="soid" value="$(soid<%=Runtxt%>)"/>
        <postfield name="ton" value="$(ton<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>

-------------<br/>
<a href='shop.asp?sid=<%=sid%>'>返回商品管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
End Function


Function login

		dim name,rs,sql,errs,turul,id1,id2,feid,paid,money,smoney,soid,ton
		name=Request.form("name")
		turul=Request.form("turul")
		id1=Request.form("id1")
		id2=Request.form("id2")
		feid=Request.form("feid")
		paid=Request.form("paid")
		money=Request.form("money")
		smoney=Request.form("smoney")
		soid=Request.form("soid")
		ton=Request.form("ton")
		errs=""
		if name="" or id1="" or id2="" or money="" or smoney="" or ton="" then errs=errs & "关键名称不能为空<br/>"
	%>
	<card id="login" title="添加商品" ontimer="shop.asp?sid=<%=sid%>"><timer value="20"/>
		<p align="left">
	<%
	IF len(errs)=0 then


		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select  * FROM qingtian_shop"
		rs.open sql,conn,1,3
		rs.addnew
			rs("name")=name
			rs("turul")=turul
			rs("id1")=id1
			rs("id2")=id2
			rs("feid")=feid
			rs("paid")=paid
			rs("money")=money
			rs("smoney")=smoney
			rs("soid")=soid
			rs("ton")=ton
		rs.update()

		rs.Close
		Set rs = Nothing
		%>添加商品成功!<br/><%

	else%>
		<%=errs%>
		<a href="addshop.asp?sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='shop.asp?sid=<%=sid%>'>返回商品管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


%>
